import java.util.Arrays;

public class Test2 {
    //升序排序
    public static void main(String[] args) {
        int []arr = {1,2,4,5,2,623,5,2636,22,624,9};
        BubbleSort(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void swap(int []array, int i, int j) {
        int tmp = array[i];
        array[i] = array[j];
        array[j] = tmp;
    }
    public static void BubbleSort(int []array) {
        for (int i = 0; i < array.length-1; i++) {
            for (int j = 0; j < array.length-1-i; j++) {
                if(array[j]>array[j+1]) {
                    swap(array,j,j+1);
                }
            }
        }
    }
}
